package com.zhangj.springcloud.controller;

import com.zhangj.springcloud.entites.CommonResult;
import com.zhangj.springcloud.entites.Payment;
import com.zhangj.springcloud.service.PaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName PaymentController
 * @Description
 * @Author zhangjie
 * @Date 2022/1/15 20:55
 * @Version 1.0
 */

@RestController
public class PaymentController {

    @Autowired
    private PaymentService paymentService;

    @RequestMapping("/consumer/payment/get/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id){

        System.out.println("id = " + id);
        System.out.println("id = " + id);
        System.out.println("id = " + id);
        return paymentService.getPaymentById(id);
    }

    @RequestMapping("/consumer/payment/creat")
    public CommonResult<Payment> creat(@RequestBody Payment payment){
       return paymentService.creat(payment);
    }
}
